<?php
/**
 * 微信群管理API验证器
 * @author 王勇程 <laughskydragon@qq.com>
 */

namespace app\api\validate;

use think\Validate;

/**
 * 微信群管理验证器
 */
class WechatGroup extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'group_id' => 'require|integer|gt:0',
        'page' => 'integer|egt:1',
        'limit' => 'integer|between:1,100',
        'keyword' => 'max:50',
        'reason' => 'require|max:100',
        'description' => 'max:500',
        'member_count' => 'integer|egt:0'
    ];

    /**
     * 验证消息
     */
    protected $message = [
        'group_id.require' => '群ID不能为空',
        'group_id.integer' => '群ID必须为整数',
        'group_id.gt' => '群ID必须大于0',
        'page.integer' => '页码必须为整数',
        'page.egt' => '页码必须大于等于1',
        'limit.integer' => '每页数量必须为整数',
        'limit.between' => '每页数量必须在1-100之间',
        'keyword.max' => '搜索关键词不能超过50个字符',
        'reason.require' => '举报原因不能为空',
        'reason.max' => '举报原因不能超过100个字符',
        'description.max' => '举报描述不能超过500个字符',
        'member_count.integer' => '成员数量必须为整数',
        'member_count.egt' => '成员数量不能为负数'
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'list' => ['page', 'limit', 'keyword'],
        'available' => ['limit'],
        'detail' => ['group_id'],
        'apply' => ['group_id'],
        'report' => ['group_id', 'reason', 'description'],
        'update_count' => ['group_id', 'member_count']
    ];
}